﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiMaterialTraits : OdGiDrawableTraits
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiMaterialTraits(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiMaterialTraits_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiMaterialTraits obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiMaterialTraits()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiMaterialTraits(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiMaterialTraits cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiMaterialTraits_cast(OdRxObject.getCPtr(pObj));
			OdGiMaterialTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiMaterialTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiMaterialTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiMaterialTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTraits_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTraits_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTraits_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiMaterialTraits createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiMaterialTraits_createObject();
			OdGiMaterialTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiMaterialTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiMaterialTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiMaterialTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void ambient(OdGiMaterialColor ambientColor)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_ambient(this.swigCPtr, OdGiMaterialColor.getCPtr(ambientColor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void diffuse(OdGiMaterialColor diffuseColor, OdGiMaterialMap diffuseMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_diffuse(this.swigCPtr, OdGiMaterialColor.getCPtr(diffuseColor), OdGiMaterialMap.getCPtr(diffuseMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void specular(OdGiMaterialColor specularColor, OdGiMaterialMap specularMap, out double glossFactor)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_specular(this.swigCPtr, OdGiMaterialColor.getCPtr(specularColor), OdGiMaterialMap.getCPtr(specularMap), out glossFactor);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void reflection(OdGiMaterialMap reflectionMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_reflection(this.swigCPtr, OdGiMaterialMap.getCPtr(reflectionMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void opacity(out double opacityPercentage, OdGiMaterialMap opacityMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_opacity(this.swigCPtr, out opacityPercentage, OdGiMaterialMap.getCPtr(opacityMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void bump(OdGiMaterialMap bumpMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_bump(this.swigCPtr, OdGiMaterialMap.getCPtr(bumpMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void refraction(out double refractionIndex, OdGiMaterialMap refractionMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_refraction(this.swigCPtr, out refractionIndex, OdGiMaterialMap.getCPtr(refractionMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double translucence()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_translucence(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double selfIllumination()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_selfIllumination(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double reflectivity()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_reflectivity(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiMaterialTraits.IlluminationModel illuminationModel()
		{
			OdGiMaterialTraits.IlluminationModel result = (OdGiMaterialTraits.IlluminationModel)GlobalsPINVOKE.OdGiMaterialTraits_illuminationModel(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiMaterialTraits.ChannelFlags channelFlags()
		{
			OdGiMaterialTraits.ChannelFlags result = (OdGiMaterialTraits.ChannelFlags)GlobalsPINVOKE.OdGiMaterialTraits_channelFlags(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiMaterialTraits.Mode mode()
		{
			OdGiMaterialTraits.Mode result = (OdGiMaterialTraits.Mode)GlobalsPINVOKE.OdGiMaterialTraits_mode(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setAmbient(OdGiMaterialColor ambientColor)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setAmbient(this.swigCPtr, OdGiMaterialColor.getCPtr(ambientColor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDiffuse(OdGiMaterialColor diffuseColor, OdGiMaterialMap diffuseMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setDiffuse(this.swigCPtr, OdGiMaterialColor.getCPtr(diffuseColor), OdGiMaterialMap.getCPtr(diffuseMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setSpecular(OdGiMaterialColor specularColor, OdGiMaterialMap specularMap, double glossFactor)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setSpecular(this.swigCPtr, OdGiMaterialColor.getCPtr(specularColor), OdGiMaterialMap.getCPtr(specularMap), glossFactor);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setReflection(OdGiMaterialMap reflectionMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setReflection(this.swigCPtr, OdGiMaterialMap.getCPtr(reflectionMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setOpacity(double opacityPercentage, OdGiMaterialMap opacityMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setOpacity(this.swigCPtr, opacityPercentage, OdGiMaterialMap.getCPtr(opacityMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setBump(OdGiMaterialMap bumpMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setBump(this.swigCPtr, OdGiMaterialMap.getCPtr(bumpMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setRefraction(double refractionIndex, OdGiMaterialMap refractionMap)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setRefraction(this.swigCPtr, refractionIndex, OdGiMaterialMap.getCPtr(refractionMap));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setTranslucence(double value)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setTranslucence(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setSelfIllumination(double value)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setSelfIllumination(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setReflectivity(double value)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setReflectivity(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setIlluminationModel(OdGiMaterialTraits.IlluminationModel model)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setIlluminationModel(this.swigCPtr, (int)model);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setChannelFlags(OdGiMaterialTraits.ChannelFlags flags)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setChannelFlags(this.swigCPtr, (int)flags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setMode(OdGiMaterialTraits.Mode value)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setMode(this.swigCPtr, (int)value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setColorBleedScale(double scale)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setColorBleedScale(this.swigCPtr, scale);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double colorBleedScale()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_colorBleedScale(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setIndirectBumpScale(double scale)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setIndirectBumpScale(this.swigCPtr, scale);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double indirectBumpScale()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_indirectBumpScale(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setReflectanceScale(double scale)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setReflectanceScale(this.swigCPtr, scale);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double reflectanceScale()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_reflectanceScale(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setTransmittanceScale(double scale)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setTransmittanceScale(this.swigCPtr, scale);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double transmittanceScale()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_transmittanceScale(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setTwoSided(bool flag)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setTwoSided(this.swigCPtr, flag);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool twoSided()
		{
			bool result = GlobalsPINVOKE.OdGiMaterialTraits_twoSided(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setLuminanceMode(OdGiMaterialTraits.LuminanceMode mode)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setLuminanceMode(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiMaterialTraits.LuminanceMode luminanceMode()
		{
			OdGiMaterialTraits.LuminanceMode result = (OdGiMaterialTraits.LuminanceMode)GlobalsPINVOKE.OdGiMaterialTraits_luminanceMode(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setLuminance(double value)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setLuminance(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double luminance()
		{
			double result = GlobalsPINVOKE.OdGiMaterialTraits_luminance(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setNormalMap(OdGiMaterialMap normalMap, OdGiMaterialTraits.NormalMapMethod method, double strength)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setNormalMap(this.swigCPtr, OdGiMaterialMap.getCPtr(normalMap), (int)method, strength);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void normalMap(OdGiMaterialMap normalMap, out OdGiMaterialTraits.NormalMapMethod method, out double strength)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_normalMap(this.swigCPtr, OdGiMaterialMap.getCPtr(normalMap), out method, out strength);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setGlobalIllumination(OdGiMaterialTraits.GlobalIlluminationMode mode)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setGlobalIllumination(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiMaterialTraits.GlobalIlluminationMode globalIllumination()
		{
			OdGiMaterialTraits.GlobalIlluminationMode result = (OdGiMaterialTraits.GlobalIlluminationMode)GlobalsPINVOKE.OdGiMaterialTraits_globalIllumination(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setFinalGather(OdGiMaterialTraits.FinalGatherMode mode)
		{
			GlobalsPINVOKE.OdGiMaterialTraits_setFinalGather(this.swigCPtr, (int)mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiMaterialTraits.FinalGatherMode finalGather()
		{
			OdGiMaterialTraits.FinalGatherMode result = (OdGiMaterialTraits.FinalGatherMode)GlobalsPINVOKE.OdGiMaterialTraits_finalGather(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum IlluminationModel
		{
			kBlinnShader,
			kMetalShader
		}

		[Flags]
		public enum ChannelFlags
		{
			kNone = 0,
			kUseDiffuse = 1,
			kUseSpecular = 2,
			kUseReflection = 4,
			kUseOpacity = 8,
			kUseBump = 16,
			kUseRefraction = 32,
			kUseNormalMap = 64,
			kUseAll = 127
		}

		public enum Mode
		{
			kRealistic,
			kAdvanced
		}

		public enum LuminanceMode
		{
			kSelfIllumination,
			kLuminance
		}

		public enum NormalMapMethod
		{
			kTangentSpace
		}

		public enum GlobalIlluminationMode
		{
			kGlobalIlluminationNone,
			kGlobalIlluminationCast,
			kGlobalIlluminationReceive,
			kGlobalIlluminationCastAndReceive
		}

		public enum FinalGatherMode
		{
			kFinalGatherNone,
			kFinalGatherCast,
			kFinalGatherReceive,
			kFinalGatherCastAndReceive
		}
	}
}
